<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Brother extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'brother';
    use HasFactory;

    protected $appends = [
        'follows_count','fans_count'
    ];

    public function getCreateTimeAttribute(string $value)
    {
        return Date("Y-m-d H:i:s",$value);
    }

    /**
     *  获取关注.
     *
     * @param string $value
     * @return string
     */
    public function getFollowsCountAttribute()
    {
        $data = rand(800,999);
        return $data > 900 ? '999+' : $data;
    }

    /**
     *  获取粉丝.
     *
     * @param string $value
     * @return string
     */
    public function getFansCountAttribute()
    {
        $data = rand(800,999);
        return $data > 900 ? '999+' : $data;
    }
}
